package com.example.customviewtest.wymusic;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.customviewtest.R;

import java.util.List;

class WYGridAdapter extends BaseQuickAdapter<MusicBean.AlbumBean, BaseViewHolder> {
    private Context context;

    public WYGridAdapter(Context context, int layout, List<MusicBean.AlbumBean> album) {
        super(layout, album);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, MusicBean.AlbumBean item) {
        ImageView img = helper.getView(R.id.grid_item_img);
        helper.setText(R.id.grid_item_name, item.getName());
        helper.setText(R.id.grid_item_num, item.getPlayNum());
        Glide.with(context).load(item.getPoster()).into(img);
    }
}
